import { Window } from "../../../component/window/Window";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../resource/ImagesConst";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { InvalidationType } from "../../../../fl/core/InvalidationType";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
//class LoveTaskBg
    
    export  class LoveTaskBg extends Window
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            return;
        }

        protected onLoveResLoadedHandler(): void
        {
            _windowBg = ResouceConst.getScaleBitmap(ImagesConst.loveBg1);
            addChild(_windowBg);
            this._windowCenter = ResouceConst.getScaleBitmap(ImagesConst.loveBg2);
            addChild(this._windowCenter);
            this._topLeftIcon = GlobalClass.getBitmap(ImagesConst.loveTitleIcon);
            addChild(this._topLeftIcon);
            this._bottomRightIcon = GlobalClass.getBitmap(ImagesConst.loveHeartBg);
            addChild(this._bottomRightIcon);
            this._flowerBg = GlobalClass.getBitmap(ImagesConst.lovelBgFlower);
            addChild(this._flowerBg);
            invalidate(InvalidationType.SIZE);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            LoaderHelp.addResCallBack(ResFileConst.loveTask, this.onLoveResLoadedHandler);
            return;
        }

        protected /* override */ updateSize(): void
        {
            super.updateSize();
            if (_windowBg) 
            {
                _windowBg.setSize(width, height);
                _windowBg.x = 0;
                _windowBg.y = 0;
            }
            if (this._windowCenter) 
            {
                this._windowCenter.setSize(width - 50, height - 50);
                this._windowCenter.x = 25;
                this._windowCenter.y = 25;
            }
            if (this._topLeftIcon) 
            {
                this._topLeftIcon.x = -33;
                this._topLeftIcon.y = -58;
            }
            if (this._bottomRightIcon) 
            {
                this._bottomRightIcon.x = width - this._bottomRightIcon.width - 2;
                this._bottomRightIcon.y = height - this._bottomRightIcon.height - 2;
            }
            if (this._flowerBg) 
            {
                this._flowerBg.x = 40;
                this._flowerBg.y = 20;
            }
            return;
        }

        protected /* var */_windowCenter: ScaleBitmap;

        protected /* var */_topLeftIcon: Object /* flash.display.Bitmap */;

        protected /* var */_bottomRightIcon: Object /* flash.display.Bitmap */;

        protected /* var */_flowerBg: Object /* flash.display.Bitmap */;
    }
